package com.dxy.netty.handlerchain;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @Description Long型转字节的编码器处理器
 * @Author dangxianyue
 * @Date 2023/1/8 16:03
 */
public class MyLong2ByteEncoder extends MessageToByteEncoder<Long> {
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("MyLong2ByteEncoder.encode 被调用");
        System.out.println("MyLong2ByteEncoder msg = " + msg);
        out.writeLong(msg);
    }
}
